import {createRouter , createWebHistory } from 'vue-router'

import  Index from '@/components/Index.vue'
import  Login from '@/components/pages/login'
import  List from '@/components/pages/wsList'
import  Room from '@/components/pages/wsTalk'
import beforeRoute from '@/router/interceptor/before.js'
const router = createRouter({
  history : createWebHistory(),
  routes : [
    {
      path: '/',
      component: Index,
      name : 'index',
      meta: {
        title: '首页',
        auth : false,
      }, 
    },
    {
      path: '/login',
      component: Login,
      name : 'login',
      meta: {
        title: '登录',
        auth : false,
      },  
    },
    {
      path: '/list',
      component: List,
      name : 'list',
      meta: {
        title: '聊天列表',
        auth : true,
      },  
    },
    {
      path: '/room/:ssid',
      component: Room,
      name : 'room',
      meta: {
        title: '聊天室',
        auth : true,
      },  
    }
  ]
})

beforeRoute(router)

export default router